Type.registerNamespace("Telerik.Web.UI.Scheduler.Rendering");
(function(c,g){var f=g.Scheduler,d=f.Rendering,h=f.DateTime,b=Telerik.Web.StringBuilder,l=60000,a=l*60,j=a*24,i=7,k=4;
d.WeekViewRenderer=function(m){this._model=m;
this._owner=m._owner;
this._resizableAllDays=false;
this._shouldAddAllDayWraps=true;
this._ownerElement=this._owner.get_element();
this._owner.add_propertyChanged(Function.createDelegate(this,this._onSchedulerPropertyChanged));
};
d.WeekViewRenderer.prototype={renderAppointment:function(m){var n=this._getAppointmentParts(m);
var o=this;
m._parts=n;
c.each(n,function(){o._model.addToBlocks(this);
if(this.isAllDay){o._addAllDayAppointmentPart(this,m);
}else{o._addAppointmentPart(this,m);
}});
this._recalcAppointmentsStyles();
},refreshView:function(){this._activateView();
this._updateHeaders();
this._updateColumnHeaders();
this._updateViewTabs();
this._updateFooter();
this._updateShowFullTimeStatus();
},refreshIndicatorState:function(){if(this._model._settings&&this._model._settings.hiddenAptsIndicator===false){return;
}if(!this._owner.get_showFullTime()){this._updateIndicators();
}else{this._clearIndicators();
}},_updateIndicators:function(){var t=[],u=[];
var r=this._model._getFirstDayStart();
var o=f.DateTime.add(f.DateTime.getDate(r),this._model.get_effectiveDayEndTime());
for(var p=0,q=this._model.get_numberOfDays();
p<q;
p++){var m=this._owner.get_appointments().getAppointmentsInRange(f.DateTime.getDate(r),r);
var s=m.find(function(v){return v.get_end()<=r;
})!=null;
var n=this._owner.get_appointments().getAppointmentsStartingInRange(o,(new Date(o)).setHours(24)).get_count()>0;
t[p]=s+0;
u[p]=n+0;
r=f.DateTime.add(r,j);
o=f.DateTime.add(o,j);
}this._owner._updateHiddenAppointmentsIndicator(t,"top");
this._owner._updateHiddenAppointmentsIndicator(u,"bottom");
},_clearIndicators:function(){this._owner._removeIndicatorsTable("rsTopIndicator");
this._owner._removeIndicatorsTable("rsBottomIndicator");
},_updateShowFullTimeStatus:function(){var o=c("div.rsTopWrap table.rsContentTable",this._ownerElement)[0];
var q=o.rows.length;
var m=this._model.get_effectiveDayEndTime()-this._model.get_effectiveDayStartTime();
var p=this._owner.get_minutesPerRow()*l;
var n=m/p;
if(q!=n){if(this._owner.get_showFullTime()){this.showFullTime();
}else{this.showBusinessTime();
}}},_updateFooter:function(){c("div.rsFooter",this._ownerElement).css("display","");
},_updateViewTabs:function(){if(c(".rsHeader ul .rsFirst",this._ownerElement).length==0){return;
}var p=c(".rsHeader ul li.rsSelected",this._ownerElement);
var r=c(this._getViewTabElement());
if(r.is(".rsSelected")){return;
}p.removeClass("rsSelected");
r.addClass("rsSelected");
var m=c("em",p);
var o=c("a",r);
var q=o.find("span");
var s=m[0].className;
m[0].className=o[0].className;
o[0].className=s;
var n=m.text();
m.text(q.text());
q.text(n);
p.append(o.clone());
r.append(m);
o.remove();
},_getViewTabElement:function(){return c(".rsHeader ul .rsHeaderWeek",this._ownerElement).parent()[0];
},_activateView:function(){var o=this._getContentElement();
if(c(o).parent().is(".rsTopWrap")){return;
}var r=c(this._ownerElement);
var m=r.find("div.rsHiddenViews");
var q=c("div.rsTopWrap",r);
var p=c("div.rsContent",q);
var n=c("div.rsHeader",q);
if(n.length>0){n.after(o);
}else{q.prepend(o);
}m.append(p);
},showBusinessTime:function(){var n=c("div.rsTopWrap table.rsContentTable",this._ownerElement);
var o=c("div.rsTopWrap table.rsVerticalHeaderTable",this._ownerElement);
this._removePrependedRows(n,o);
this._removeAppendedRows(n,o);
var m=this._owner.get_localization().Show24Hours;
c("div.rsFooter a.rsFullTime",this._ownerElement).text(m);
},_removeAppendedRows:function(n,p){var q=(j-this._model.get_dayEndTime())/(this._owner.get_minutesPerRow()*l);
var o=c(n[0].rows);
var m=o.length-q-1;
o.filter(":gt("+(m)+")").remove();
p.find("tr:gt("+(m)+")").remove();
},_removePrependedRows:function(m,o){var p=this._model.get_dayStartTime()/(this._owner.get_minutesPerRow()*l);
var n=c(m[0].rows);
n.filter(":lt("+(p)+")").remove();
o.find("tr:lt("+(p)+")").remove();
},showFullTime:function(){var o=c("div.rsTopWrap table.rsContentTable",this._ownerElement);
var q=c("div.rsTopWrap table.rsVerticalHeaderTable",this._ownerElement);
var n=this._owner.get_rowHeight();
var p=o[0].rows[0].cells.length;
this._addRows(o,q,n,p,true);
this._addRows(o,q,n,p);
this._refreshRowHeaders();
var m=this._owner.get_localization().ShowBusinessHours;
c("div.rsFooter a.rsFullTime",this._ownerElement).text(m);
if($telerik.isSafari){o.appendTo(o.parent());
q.appendTo(q.parent());
}},_refreshRowHeaders:function(){var o=c("div.rsTopWrap table.rsVerticalHeaderTable",this._ownerElement);
var m=this._owner.get_timeLabelRowSpan();
var n=this;
o.find("tr").each(function(q){var p=c(this);
if(q%m==0){p.find("div").html(n._getRowHeaderText(q));
}else{p.find("div").html("");
}if(q%m==m-1){p.addClass("rsAlt");
}else{p.removeClass("rsAlt");
}});
},_getRowHeaderText:function(q){var m=new Date(0);
m.setHours(0);
m.setMinutes(0);
var o=this._owner.get_minutesPerRow()*l;
var p=h.add(m,o*q);
var n=this._owner.get_hoursPanelTimeFormat().replace("tt","'<span class=\"rsAmPm\">'tt'</span>'");
return this._getFormattedDateText(p,n);
},_onSchedulerPropertyChanged:function(m,n){if(n.get_propertyName()=="timeLabelRowSpan"){this._refreshRowHeaders();
}},_getDayOfWeek:function(n){var m=this._owner.get_firstDayOfWeek()+n;
if(m>6){m-=7;
}return m;
},_getCellClass:function(n){var m=this._getDayOfWeek(n);
if(m==g.DayOfWeek.Saturday){return"rsSatCol";
}if(m==g.DayOfWeek.Sunday){return"rsSunCol";
}return"";
},_addRows:function(q,o,r,t,y){var p=0;
if(y){p=this._getNumberOfRowsToPrepend();
}else{p=this._getNumberOfRowsToAppend();
}for(var m=0;
m<p;
m++){var u=[];
u[u.length]='<tr style="height:';
u[u.length]=r;
u[u.length]='"></tr>';
var w=c(u.join(""));
var v=w.clone();
var s=[];
s[s.length]="<th><div>";
s[s.length]="</div></th>";
if(y){v.prependTo(o);
}else{v.appendTo(o);
}v.append(s.join(""));
if((y&&m%2==0)||(!y&&m%2!=0)){w.addClass("rsAlt");
}for(var n=0;
n<t;
n++){var x=[];
x[x.length]='<td class="';
x[x.length]=this._getCellClass(n);
x[x.length]='">&nbsp;</td>';
w.append(c(x.join("")));
}if(y){q.prepend(w);
}else{q.append(w);
}}},_getNumberOfRowsToAppend:function(){return(j-this._model.get_dayEndTime())/(this._owner.get_minutesPerRow()*l);
},_getNumberOfRowsToPrepend:function(){return this._model.get_dayStartTime()/(this._owner.get_minutesPerRow()*l);
},_getContentElement:function(){return c(".rsContent.rsWeekView",this._ownerElement)[0];
},_getFormatString:function(){var m=this._getHeaderDateFormat();
return"{0:"+m+"} - {1:"+m+"}";
},_getHeaderDateFormat:function(){return this._model.get_headerDateFormat();
},_getHeaderDateText:function(){var n=this._getHeaderDateFormat();
var o=this._model.get_visibleRangeStart();
var m=this._getFormattedDateText(o,n);
var q=f.DateTime.add(this._model.get_visibleRangeEnd(),-j);
var p=this._getFormattedDateText(q,n);
return String.format("{0} - {1}",m,p);
},_updateHeaders:function(){var m=this._getHeaderDateText();
c("div.rsTopWrap div.rsHeader h2",this._ownerElement).text(m);
},_updateColumnHeaders:function(){var m=this._model.get_columnHeaderDateFormat();
var o=this._model.get_visibleRangeStart();
var n=c("div.rsTopWrap table.rsHorizontalHeaderTable",this._ownerElement);
if(n.length>0){c.each(n[0].rows[0].cells,function(){c(this).html("<a class='rsDateHeader' href='#'>"+o.localeFormat(m)+"</a>");
o=f.DateTime.add(o,j);
});
}},_recalcAppointmentsStyles:function(){var m=this;
this._model._blockCollection.forEach(function(n){c(n.element).css({width:m._getWidthPercent(n)+"%",left:m._getLeftPercent(n)+"%"});
});
},_getVisibleDuration:function(r,m){var n=new h(r.get_startTime()).get_date().add(this._model.get_effectiveDayStartTime()).toDate();
var o=new h(r.get_startTime()).get_date().add(this._model.get_effectiveDayEndTime()).toDate();
var q=Math.max(m.get_start(),n);
var p=Math.min(m.get_end(),o);
return Math.min(p-q,m.get_duration());
},_getAppointmentElementHeight:function(m){var o=Math.ceil(m/(this._owner.get_minutesPerRow()*l));
var n=o*parseInt(this._owner.get_rowHeight());
n-=k;
return n;
},_addAppointmentPart:function(q,n){var t=q.start;
var o=q.end;
var m=this._model._getTimeSlotForAppointmentPart(q);
var r=c(m.get_domElement());
if(r.children().length==0){r.html("<div class='rsWrap'></div>");
}var v=o-t;
var s=this._buildAptStyles(n);
s.push("width: ",this._getWidthPercent(q),"%;");
s.push("left: ",this._getLeftPercent(q),"%;");
var p=this._getAppointmentElementHeight(v)+"px";
var u=c(this.getAppointmentHtml(n,true,p,s.join("")))[0];
q.element=u;
Array.add(n._domElements,u);
if(n.get_start()<t){this._addArrow(u,"Top");
}if(n.get_end()>o){this._removeResizeGrip(n);
this._addArrow(u,"Bottom");
}r.children(":first").append(u);
},_mapAppointmentStyles:function(m,n){var o=[];
c.each(n,function(q,p){var r=m[p];
if(r){o.push(q,": ",r,";");
}});
return o;
},_buildAptStyles:function(m){if(!m._hasSimpleStyling()){return[];
}return this._mapAppointmentStyles(m,{"background-color":"_backColor","border-top-color":"_borderColor","border-bottom-color":"_borderColor","border-top-width":"_borderWidth","border-bottom-width":"_borderWidth","border-top-style":"_borderStyle","border-bottom-style":"_borderStyle"});
},_buildAptOutStyles:function(m){if(!m._hasSimpleStyling()){return[];
}return this._mapAppointmentStyles(m,{"border-left-color":"_borderColor","border-right-color":"_borderColor","border-left-width":"_borderWidth","border-right-width":"_borderWidth","border-left-style":"_borderStyle","border-right-style":"_borderStyle"});
},_getLeftPercent:function(m){var n=m.column;
if(!n){return 0;
}return n.get_left();
},_getWidthPercent:function(m){var n=m.column;
if(!n){return 100;
}return n.get_width();
},_addAllDayAppointmentPart:function(q,m){var o=q.start;
var p=q.end;
var r=this._model._getAllDayTimeSlotForAppointmentPart(q);
var s=this._getTargetWrapper(r,q.rowIndex);
if(!s){return;
}var n=this._createAllDayAppointmentElement(p-o,m)[0];
q.element=n;
if(!m._domElement){m._domElement=n;
}Array.add(m._domElements,n);
if(m.get_start()<this._model.get_visibleRangeStart()){this._addArrow(n,"Left");
}if(this._model.get_visibleRangeEnd()<m.get_end()){this._removeResizeGrip(m);
this._addArrow(n,"Right");
}s.append(n);
if(this._shouldAddAllDayWraps){c(r.get_domElement()).append(c(this.getWrapperHtml()));
}},_createAllDayAppointmentElement:function(p,m){var o=(Math.ceil((p/j))*100);
var n=(parseInt(this._owner._rowHeight)-k)+"px";
var q=this._buildAptStyles(m);
q.push("width: ",o,"%;");
return c(this.getAppointmentHtml(m,this._resizableAllDays,n,q.join("")));
},_getAppointmentParts:function(y){var t=[];
var v=this._model;
var r=v._owner.get_showAllDayRow();
var w=f.DateTime.getDate(v.get_visibleRangeStart());
for(var s=0,u=v.get_numberOfDays();
s<u;
s++){var n=f.DateTime.add(w,j*s);
var q=f.DateTime.add(n,j);
if(r&&y._rangeIsInsideAppointment(n,q)){Array.add(t,{isAllDay:true,start:n,end:q,appointment:y});
}else{var o=f.DateTime.add(n,v.get_effectiveDayStartTime());
var m=f.DateTime.add(n,v.get_effectiveDayEndTime());
if(y._isInRange(o,m)){var x=new Date(Math.max(o,y.get_start()));
var p=new Date(Math.min(m,y.get_end()));
Array.add(t,{isAllDay:false,start:x,end:p,appointment:y});
}}}return this._mergeAllDayParts(t);
},_mergeAllDayParts:function(n){var m=[];
c.each(n,function(p){if(p==0){Array.add(m,this);
return;
}var o=m[m.length-1];
if(this.isAllDay&&o.isAllDay){o.end=this.end;
}else{Array.add(m,this);
}});
return m;
},_removeResizeGrip:function(m){c(m.get_element()).find("div.rsAptResize").remove();
},_getRowIndex:function(m){return m._getRowIndex();
},_addAllDayWraps:function(p,q){var n=q.children().length;
var m=(p+1)-n;
for(var o=0;
o<m;
o++){q.append(this.getWrapperHtml());
}},_getTargetWrapper:function(o,n){var m=c(o.get_domElement());
if(this._shouldAddAllDayWraps){this._addAllDayWraps(n,m);
}var p=m.children().eq(n);
if(p.length==0){return;
}p[0].style.zIndex=m[0].parentNode.cells.length-m[0].cellIndex;
return p;
},_addArrow:function(m,o){var n=c(m).find("div.rsAptIn");
n.append(String.format('<a style="z-index: 80;" href="#" class="rsArrow{0}">{1}</a>',o,o.toLowerCase()));
n.addClass(String.format("rsWArrow{0}",o));
},removeAppointment:function(n){if(!n._parts){return;
}var o=this;
var m=null;
if(n._originalParent){m=n._originalParent.parentNode;
}c.each(n._parts,function(){if(this.isAllDay&&o._shouldAddAllDayWraps){o._removeAllDayWrappers(this,m);
}if(this.element){var p=this.element.parentNode;
if(p){p.removeChild(this.element);
}}o._model.removeFromBlock(this);
});
},_removeAllDayWrappers:function(p,u){var t=u||p.element.parentNode.parentNode;
if(!t){return;
}var q=c(t);
var s=q.parent().children().index(q);
var v=p.end-p.start;
var r=Math.ceil(v/j);
var m=q.parent().children().slice(s,s+r);
var o=p.rowIndex;
var n=m.children("div:nth-child("+(o+1)+")");
n.not(":only-child").remove();
},getWrapperHtml:function(){var m=[];
m[m.length]="<div class='rsWrap' style='height:";
m[m.length]=this._owner._rowHeight;
m[m.length]="'></div>";
return m.join("");
},getAppointmentHtml:function(s,o,t,r){var n=new b().append("<div class='").append(this._getClassName(s)).append("' id='").append(this._getUniqueID());
var m=s.get_toolTip();
if(m){n.append("' title='").append(m);
}var q=new b().append("style='height: ",t,"'").toString();
var p=new b().append("style='height: ",t,";").append(this._buildAptOutStyles(s).join("")).append("'").toString();
n.append("' style='height: ").append(t).append(";").append(r).append("'><div class='rsAptOut' ").append(p).append("><div class='rsAptMid' ").append(q).append("><div class='rsAptIn' ").append(q).append("><div class='rsAptContent' ").append(q).append(">").append(this._getRecurrenceIconHtml(s)).append(s.get_subject()).append("<a href='#' class='rsAptDelete' style='visibility: hidden;'>delete</a></div></div>").append(o?"<div class='rsAptResize'></div>":"").append("</div></div></div>");
return n.toString();
},_getClassName:function(m){var p=[];
var n=this;
p.push("rsApt");
var o=m.get_cssClass();
if(o){p.push(o);
}m.get_resources().forEach(function(s){n._addUniqueClassName(p,s.get_cssClass());
var q=m.get_owner();
if(q){c.each(q.get_resourceStyles().getMatchingClasses(s),function(){n._addUniqueClassName(p,this);
});
var r=q.get_resources().getResourceByTypeAndKey(s.get_type(),s.get_key());
if(r){n._addUniqueClassName(p,r.get_cssClass());
}}});
if(m._hasSimpleStyling()){p.push("rsAptSimple");
}return p.join(" ");
},_addUniqueClassName:function(n,m){if(m&&Array.indexOf(n,m)==-1){n.push(m);
}},_getRecurrenceIconHtml:function(m){var n=m.get_recurrenceState();
if(n!=g.RecurrenceState.NotRecurring){if(n==g.RecurrenceState.Exception){return'<div class="rsAptRecurrenceException"></div>';
}else{return'<div class="rsAptRecurrence"></div>';
}}return"";
},_getUniqueID:function(){return Math.abs((new Date()).getTime()^Math.floor(Math.random()*100000000)).toString();
},_getFormattedDateText:function(o,m){var p=o.getDate();
var n=o.getMonth()+1;
var q=o.getFullYear();
if(Sys.CultureInfo.CurrentCulture&&Sys.CultureInfo.CurrentCulture.name=="en-US"){switch(m){case"dd":if(p<10){return"0"+p;
}else{return p;
}break;
case"d":return String.format("{0}/{1}/{2}",n,p,q);
break;
}}return o.localeFormat(m);
}};
d.WeekViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.WeekViewRenderer");
d.DayViewRenderer=function(m){d.DayViewRenderer.initializeBase(this,[m]);
};
d.DayViewRenderer.prototype={_getHeaderDateText:function(){var m=this._model.get_visibleRangeStart();
return m.localeFormat(this._getHeaderDateFormat());
},_getContentElement:function(){return c(".rsContent.rsDayView",this._ownerElement)[0];
},_getViewTabElement:function(){return c(".rsHeader ul .rsHeaderDay",this._ownerElement).parent()[0];
},_updateColumnHeaders:function(){}};
d.DayViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.DayViewRenderer",d.WeekViewRenderer);
d.TimelineViewRenderer=function(m){d.TimelineViewRenderer.initializeBase(this,[m]);
this._resizableAllDays=true;
};
d.TimelineViewRenderer.prototype={_updateFooter:function(){c("div.rsFooter",this._ownerElement).css("display","none");
},_updateShowFullTimeStatus:function(){},_recalcAppointmentsStyles:function(){},_updateIndicators:function(){},_clearIndicators:function(){},_getAppointmentParts:function(m){var q=[];
var s=this._model;
for(var r=0,n=s._getNumberOfSlots();
r<n;
r++){var p=f.DateTime.add(s.get_visibleRangeStart(),s._getSlotDuration()*r);
var o=f.DateTime.add(p,s._getSlotDuration());
if(m._isInRange(p,o)){Array.add(q,{isAllDay:true,start:p,end:o,appointment:m});
}}return this._mergeAllDayParts(q);
},_createAllDayAppointmentElement:function(p,m){var o=(Math.ceil((p/this._model._getSlotDuration()))*100)+"%";
var n=(parseInt(this._owner._rowHeight)-k)+"px";
var q=this._buildAptStyles(m);
q.push(String.format("width: {0};",o));
return c(this.getAppointmentHtml(m,this._resizableAllDays,n,q.join("")));
},_updateColumnHeaders:function(){this._updateDateColumnHeaders(c("div.rsTopWrap table.rsHorizontalHeaderTable th",this._ownerElement));
},_updateDateColumnHeaders:function(q){var o=this._model._getSlotDuration();
var m=this._model.get_visibleRangeStart();
var p=this._model._getTimeLabelSpan();
var n=this;
q.each(function(){var r=n._getColumnHeaderText(m);
c(this).text(r);
m=new h(m).add(o*p).toDate();
});
},_getColumnHeaderText:function(m){return this._getFormattedDateText(m,this._model.get_columnHeaderDateFormat());
},_getContentElement:function(){return c(".rsContent.rsTimelineView",this._ownerElement)[0];
},_getViewTabElement:function(){return c(".rsHeader ul .rsHeaderTimeline",this._ownerElement).parent()[0];
},_getHeaderDateText:function(){var n=this._getHeaderDateFormat();
var o=this._model.get_visibleRangeStart();
var m=this._getFormattedDateText(o,n);
var q=f.DateTime.add(this._model.get_visibleRangeEnd(),-this._model._getSlotDuration());
var p=this._getFormattedDateText(q,n);
return String.format("{0} - {1}",m,p);
}};
d.TimelineViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.TimelineViewRenderer",d.WeekViewRenderer);
d.MonthViewRenderer=function(m){d.MonthViewRenderer.initializeBase(this,[m]);
this._weekLength=this._model.get_weekLength();
this._shouldAddAllDayWraps=false;
this._contentElement=c(".rsContent.rsMonthView",this._ownerElement)[0];
this._contentTables=c("table tr td.rsContentWrapper table.rsContentTable",this._contentElement);
};
d.MonthViewRenderer.prototype={_updateIndicators:function(){},_clearIndicators:function(){},refreshView:function(){var o=f.DateTime.subtract(this._model.get_visibleRangeEnd(),this._model.get_visibleRangeStart());
var p=Math.ceil(o/j);
var m=Math.ceil(p/i);
var n=c("table.rsContentTable:first tr",this._getContentElement()).length;
if(n<m){this._addContentRows(m-n);
}else{if(n>m){this._removeContentRows(n-m);
}}c("div.rsShowMore",this._contentElement).removeClass("rsShowMore").html("");
d.MonthViewRenderer.callBaseMethod(this,"refreshView");
},_recalcAppointmentsStyles:function(){},_updateShowFullTimeStatus:function(){},_updateFooter:function(){c("div.rsFooter",this._ownerElement).css("display","none");
},_getTargetWrapper:function(n,m){return d.MonthViewRenderer.callBaseMethod(this,"_getTargetWrapper",[n,m+1]);
},_updateColumnHeaders:function(){var o=this;
var q=this._model.get_dayHeaderDateFormat();
var m=this._model.get_firstDayHeaderDateFormat();
var p=o._owner.get_selectedDate().getMonth();
var n=o._model.get_visibleRangeStart();
c.each(this._contentTables,function(){var u=c("td div.rsDateWrap div.rsDateBox a",this);
var s=n;
var t=0;
var r=new Date(s.getTime());
u.each(function(){var x=h.subtract(s,n)==0&&s.getMonth()==p;
var w;
if(s.getDate()==1||x){w=s.localeFormat(m);
}else{w=o._getFormattedDateText(s,q);
}this.innerHTML=w;
var v=p!=s.getMonth();
var y=this.parentNode.parentNode.parentNode;
c(y).toggleClass("rsOtherMonth",v);
if(t==o._weekLength-1){r=h.add(r,7*j);
s=new Date(r.getTime());
t=0;
}else{s=h.add(s,j);
t++;
}o._clearExtraWraps(y);
});
});
},_getAppointmentParts:function(w){var s=[];
var u=this._model;
var v=this._weekLength;
var r=h.subtract(u.get_visibleRangeEnd(),u.get_visibleRangeStart())/j;
var x=u.get_visibleAppointmentsPerDay();
for(var y=0,A=r/v;
y<A;
y++){var o=[];
var z=h.add(u.get_visibleRangeStart(),i*y*j);
var B=f.DateHelper.getStartOfWeek(z,this._owner.get_firstDayOfWeek(),v);
for(var m=0;
m<v;
m++){var p=h.add(B,m*j);
var n=h.add(p,j);
if(w._isInRange(p,n)){var q=this._getSlotForDay(w,p);
var t=this._getAppointmentsInDay(p,n);
if(t<=x){this._ensureWraps(q,t+1);
Array.add(o,{isAllDay:true,start:p,end:n,appointment:w});
}else{this._renderShowMore(q);
}}}o=this._mergeAllDayParts(o);
Array.addRange(s,o);
}return s;
},_getAppointmentsInDay:function(m,n){return this._owner.get_appointments().getAppointmentsInRange(m,n).findAll(function(o){return(o.get_visible());
}).get_count();
},_getSlotForDay:function(m,o){var n=m.clone();
n.set_start(o);
return this._model.getTimeSlotForAppointment(n);
},_renderShowMore:function(p){var o=c(".rsLastWrap",p.get_domElement());
var m=this._owner.get_localization().ShowMore;
if(c(".rsApt",o).length==0){o.addClass("rsShowMore").text(m);
}else{var n=c("<div class='rsLastWrap rsWrap rsShowMore'>"+m+"</div>");
o.removeClass("rsLastWrap").after(n);
}},_ensureWraps:function(s,p){var m=s.get_domElement();
var o=c("div.rsWrap",m).length;
var n=p-o;
if(n<=0){return;
}for(var r=0;
r<n;
r++){var q=c("<div class='rsWrap'></div>");
c("div.rsLastWrap",m).removeClass("rsLastWrap").after(q);
q.addClass("rsLastWrap");
}},_clearExtraWraps:function(p){var o=4;
var m=c("div.rsWrap",p).length-o;
if(m>0){for(var n=0;
n<m;
n++){c("div.rsWrap:nth(1)",p).remove();
}}},removeAppointment:function(m){var n=this._model;
c("div.rsShowMore",this._contentElement).each(function(){var o=n.getTimeSlotFromDomElement(this);
if(o&&m._isInRange(o.get_startTime(),o.get_endTime())){c(this).removeClass("rsShowMore");
this.innerHTML="";
}});
d.MonthViewRenderer.callBaseMethod(this,"removeAppointment",[m]);
},_addContentRows:function(m){for(var n=0;
n<m;
n++){c("div.rsTopWrap table.rsContentTable",this._ownerElement).append(this._getMonthRowHtml());
}},_removeContentRows:function(m){for(var n=0;
n<m;
n++){c("div.rsTopWrap table.rsContentTable tr:last-child",this._ownerElement).remove();
}},_getMonthRowHtml:function(){var m=[];
m[m.length]="<tr class='rsRow'>";
for(var n=0;
n<this._weekLength;
n++){m[m.length]="<td>";
for(var o=0;
o<4;
o++){m[m.length]="<div class='rsWrap";
if(o==0){m[m.length]=" rsDateWrap";
}if(o==3){m[m.length]=" rsLastWrap";
}m[m.length]="'>";
if(o==0){m[m.length]="<div class='rsDateBox'><a class='rsDateHeader' href='#'></a></div>";
}m[m.length]="</div>";
}m[m.length]="</td>";
}m[m.length]="</tr>";
return m.join("");
},_getContentElement:function(){return this._contentElement;
},_getRowIndex:function(m){return m._getRowIndex()+1;
},_getHeaderDateText:function(){var m=this._getHeaderDateFormat();
var n=this._owner.get_selectedDate();
return n.localeFormat(m);
},_getFormatString:function(){var m=this._getHeaderDateFormat();
return"{0:"+m+"}";
},_getViewTabElement:function(){return c(".rsHeader ul .rsHeaderMonth",this._ownerElement).parent()[0];
}};
d.MonthViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.MonthViewRenderer",d.WeekViewRenderer);
d.ResourceGroupedWeekViewRenderer=function(m){d.ResourceGroupedWeekViewRenderer.initializeBase(this,[m]);
};
d.ResourceGroupedWeekViewRenderer.prototype={_updateIndicators:function(){},_clearIndicators:function(){},_getAppointmentParts:function(m){return e.call(this,m);
},_recalcAppointmentsStyles:function(){var m=this;
c.each(this._model._weekModels,function(){this._blockCollection.forEach(function(n){c(n.element).css({width:m._getWidthPercent(n)+"%",left:m._getLeftPercent(n)+"%"});
});
});
},_updateShowFullTimeStatus:function(){if(!this._model._isVertical){d.ResourceGroupedWeekViewRenderer.callBaseMethod(this,"_updateShowFullTimeStatus",[]);
}},_updateColumnHeaders:function(){if(this._model._isVertical){d.ResourceGroupedWeekViewRenderer.callBaseMethod(this,"_updateColumnHeaders",[]);
return;
}var r=this._model.get_columnHeaderDateFormat();
var o=c("div.rsTopWrap table.rsHorizontalHeaderTable",this._ownerElement);
var q=this._model.get_numberOfDays();
var t=this._model.get_visibleRangeStart();
var m=t;
if(o.length>0){var n=o[0].rows;
var s=n[n.length-1];
var p=0;
c.each(s.cells,function(){this.innerHTML=m.localeFormat(r);
m=f.DateTime.add(m,j);
if(p++==q-1){m=t;
p=0;
}});
}}};
d.ResourceGroupedWeekViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.ResourceGroupedWeekViewRenderer",d.WeekViewRenderer);
d.ResourceGroupedDayViewRenderer=function(m){d.ResourceGroupedDayViewRenderer.initializeBase(this,[m]);
};
d.ResourceGroupedDayViewRenderer.prototype={_updateIndicators:function(){},_clearIndicators:function(){},_getAppointmentParts:function(m){return e.call(this,m);
},_recalcAppointmentsStyles:function(){var m=this;
c.each(this._model._weekModels,function(){this._blockCollection.forEach(function(n){c(n.element).css({width:m._getWidthPercent(n)+"%",left:m._getLeftPercent(n)+"%"});
});
});
},_updateShowFullTimeStatus:function(){if(!this._model._isVertical){d.ResourceGroupedDayViewRenderer.callBaseMethod(this,"_updateShowFullTimeStatus",[]);
}}};
d.ResourceGroupedDayViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.ResourceGroupedDayViewRenderer",d.DayViewRenderer);
d.ResourceGroupedTimelineViewRenderer=function(m){d.ResourceGroupedTimelineViewRenderer.initializeBase(this,[m]);
};
d.ResourceGroupedTimelineViewRenderer.prototype={_updateIndicators:function(){},_clearIndicators:function(){},renderAppointment:function(m){d.ResourceGroupedTimelineViewRenderer.callBaseMethod(this,"renderAppointment",[m]);
if(this._model._isVertical){var n=c(m.get_element()).parents("tr:first")[0].rowIndex;
this._updateRowHeaderHeight(n);
}},_getAppointmentParts:function(m){return e.call(this,m);
},removeAppointment:function(m){if(!m._parts){return;
}var n=c(m.get_element()).parents("tr:first")[0];
d.ResourceGroupedTimelineViewRenderer.callBaseMethod(this,"removeAppointment",[m]);
if(!n){return;
}var o=n.rowIndex;
if(this._model._isVertical){this._updateRowHeaderHeight(o);
}},refreshView:function(){d.ResourceGroupedTimelineViewRenderer.callBaseMethod(this,"refreshView",[]);
if(this._model._isVertical){for(var m=0;
m<this._model._timelineModels.length;
m++){this._updateRowHeaderHeight(m);
}}},_updateRowHeaderHeight:function(q){var p=c("div.rsTopWrap table.rsVerticalHeaderTable",this._ownerElement);
if(p.length==0){return;
}var m=c("div.rsTopWrap table.rsAllDayTable",this._ownerElement)[0].rows[q];
var n=0;
c.each(m.cells,function(){n=Math.max(c("div.rsWrap",this).length,n);
});
var o=parseInt(this._owner.get_rowHeight());
var r=(o*n)+"px";
c(p[0].rows[q].cells[0]).css("height",r);
},_updateColumnHeaders:function(){if(this._model._isVertical){d.ResourceGroupedTimelineViewRenderer.callBaseMethod(this,"_updateColumnHeaders");
return;
}var n=this._model._getNumberOfSlots();
var p=c("div.rsTopWrap table.rsHorizontalHeaderTable tr:eq(1) th",this._ownerElement);
for(var o=0,m=p.length;
o<m;
o+=n){this._updateDateColumnHeaders(p.slice(o,o+n));
}}};
d.ResourceGroupedTimelineViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.ResourceGroupedTimelineViewRenderer",d.TimelineViewRenderer);
d.ResourceGroupedMonthViewRenderer=function(m){d.ResourceGroupedMonthViewRenderer.initializeBase(this,[m]);
};
d.ResourceGroupedMonthViewRenderer.prototype={_getAppointmentParts:function(m){return e.call(this,m);
}};
d.ResourceGroupedMonthViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.ResourceGroupedMonthViewRenderer",d.MonthViewRenderer);
d.DateGroupedWeekViewRenderer=d.WeekViewRenderer;
d.DateGroupedMonthViewRenderer=d.MonthViewRenderer;
d.DateGroupedTimelineViewRenderer=d.TimelineViewRenderer;
function e(m){var p=[];
var n=this._model;
var o=this;
m.get_resources().forEach(function(r){var s=n._resources.getResourceByTypeAndKey(r.get_type(),r.get_key());
if(s){var t=n._resources.indexOf(s);
var q=Object.getType(o).callBaseMethod(o,"_getAppointmentParts",[m]);
c.each(q,function(){this.modelIndex=t;
});
Array.addRange(p,q);
}});
return p;
}})($telerik.$,Telerik.Web.UI);
